﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;

namespace TMIS
{
    public partial class frmOpenReport : frmCommon
    {
        private Guid guid;
        private BLL.OpenReport bll = new BLL.OpenReport();
        public frmOpenReport()
        {
            InitializeComponent();
        }
        public frmOpenReport(Guid guid)
        {
            this.guid = guid;
            InitializeComponent();
            this.FillComponent();

        }
        /// <summary>
        /// 控件数据填充
        /// </summary>
        private void FillComponent()
        {
            Model.OpenReport op = bll.Get(guid);
            txtBasis.Text = op.Basis;
            txtTarget.Text = op.Target;
            txtMethod.Text = op.Method;
            txtProgress.Text = op.Progress;
            txtReference.Text = op.Reference;
            this.Priview();
        }
        public override void Save()
        {
            Model.OpenReport openreport = new Model.OpenReport()
            {
                ID = this.guid,
                Basis = txtBasis.Text,
                Target = txtTarget.Text,
                Method  = txtMethod.Text,
                Progress = txtProgress.Text,
                Reference=txtReference.Text
            };
            bll.Update(openreport);

        }

        public override void Priview()
        {
            this.openReportTableAdapter.FillByStudentID(this.reportDS.OpenReport,this.guid);
            this.reportViewer.RefreshReport();
        }
    }
}
